<?php

session_start();

include_once dirname(dirname(__FILE__)) . '/include/common.php';
$core = new core();
$product_id = isset($_POST["product_id"]) ? intval($_POST["product_id"]) : 0;
$store_price = isset($_POST["store_price"]) ? $_POST["store_price"] : 0;
$store_price = floatval(preg_replace('/[^\d.]/', '', $store_price));
$stamp_price = isset($_POST["stamp_price"]) ? $_POST["stamp_price"] : 0;
$stamp_price = floatval(preg_replace('/[^\d.]/', '', $stamp_price));
$product = $core->getProductById($product_id);
    if (!$product) {
        echo json_encode(array('type' => 1, 'msg' => "Sản phẩm không tồn tại!"));
        die;
    }else{
        $core->db->query("UPDATE zen_product SET store_price=".$store_price.",stamp_price=".$stamp_price." WHERE product_id=$product_id");
        echo json_encode(array('type' => 0, 'msg' => "OK!"));
        die;
    }
?>
